home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.06 Jun 90 / MacMainframe Source / HyperTalk Handlers < prev   
Encoding:
Text File  |  1989-09-27  |  4.4 KB  |  165 lines  |  [TEXT/nX^n]

  1. --------------------------------------------------------------------
  2. --
  3. -- STARTUPSESSION function
  4. -- Startup the session by an INIT, OPEN, and CONNECT.
  5. -- Return true if startup was done without error.
  6. -- If any error occurs, terminate and return false.
  7. --
  8. -- Script by John R. Powers, III
  9. --           Easy Street Software
  10. --
  11. -- XFCNs used: TriData3270
  12. -- XCMDs used: none
  13. -- HANDLERS used: setupGlobals, showResult, updateDebug
  14. -- FUNCTIONS used: none
  15. --
  16. function startupSession
  17.   setupGlobals
  18.   get TriData3270("INIT_3270_API", "myMethod")
  19.   showResult(it)
  20.   if item 1 of it ≠ 0 then return false
  21.   get TriData3270("OPEN_HOST_CONNECTION", "myMethod")
  22.   showResult(it)
  23.   if item 1 of it ≠ 0 then
  24.     get TriData3270("TERM_3270_API")
  25.     return false
  26.   end if
  27.   get TriData3270("CONNECT_TO_PS", "mySession", "sync", "")
  28.   showResult(it)
  29.   if item 1 of it ≠ 0 then
  30.     get TriData3270("TERM_3270_API")
  31.     return false
  32.   end if
  33.   updateDebug
  34.   return true
  35. end startupSession
  36.  
  37. --------------------------------------------------------------------
  38. --
  39. -- GET_UPDATE button
  40. -- Initiate an async Get_Update for PS and OIA.
  41. -- Handlers  are in the background script.
  42. --
  43. -- Script by John R. Powers, III
  44. --           Easy Street Software
  45. --
  46. -- XFCNs used: TriData3270
  47. -- XCMDs used: none
  48. -- HANDLERS used: showResult, updateStatus
  49. -- FUNCTIONS used: none
  50. --
  51. on mouseUp
  52.   global TD3270temp
  53.   showResult(tridata3270("GET_UPDATE",¬
  54.   "mySession","async","50","cd fld PS","","","","cd fld OIA"))
  55.   updateStatus
  56. end mouseUp
  57.  
  58. --------------------------------------------------------------------
  59. --
  60. -- CHKUPD button
  61. -- Check the state of Get_Update.
  62. -- This forces an update of the fields passed
  63. -- in the Get_Update command.
  64. -- Handlers  are in the background script.
  65. --
  66. -- Script by John R. Powers, III
  67. --           Easy Street Software
  68. --
  69. -- XFCNs used: TriData3270
  70. -- XCMDs used: none
  71. -- HANDLERS used: showResult, updateStatus
  72. -- FUNCTIONS used: none
  73. --
  74. on mouseUp
  75.   global TD3270temp
  76.   showResult(TriData3270State("GET_UPDATE", "mySession"))
  77.   updateStatus
  78. end mouseUp
  79.  
  80. --------------------------------------------------------------------
  81. --
  82. -- SHOWRESULT function
  83. -- Posts the return from the TriData3270 function.
  84. -- Separates the result code (always item #1).
  85. -- Gets the result message from the result code
  86. -- and posts both to the display.
  87. -- Also displays the mySession global since
  88. -- TriData3270 may have updated it.
  89. --
  90. -- Script by John R. Powers, III
  91. --           Easy Street Software
  92. --
  93. -- XFCNs used: TriData3270Result
  94. -- XCMDs used: none
  95. -- HANDLERS used: showResult
  96. -- FUNCTIONS used: none
  97. --
  98. on showResult resultInfo
  99.   global mySession
  100.   put empty into cd fld resultCode -- flash to show update
  101.   put empty into cd fld resultMessage -- flash to show update
  102.   put resultInfo into cd fld resultCode
  103.   put TriData3270Result(item 1 of resultInfo) into cd fld resultMessage
  104.   put mySession into cd fld Session
  105. end showResult
  106.  
  107. --------------------------------------------------------------------
  108. --
  109. -- background field MEMORY HANDLE
  110. --
  111. -- Call the Debuger with the memory handle.
  112. -- Intended for use with MacsBug.  The label
  113. -- "masHan" below refers to one of many MacsBug
  114. -- templates that were designed for TriData3270.
  115. -- It won't do you any good unless you have
  116. -- installed the TriData3270 templates in your MacsBug.
  117. -- MacsBug 6.0 or better is required for this feature.
  118. --
  119. -- Script by John R. Powers, III
  120. --           Easy Street Software
  121. --
  122. -- XFCNs used: none
  123. -- XCMDs used: DebugStr
  124. -- HANDLERS used: none
  125. -- FUNCTIONS used: none
  126. --
  127. on mouseUp
  128.   global TD3270memory
  129.   if TD3270memory is not empty then
  130.     put ";dm" && TD3270memory && "masHan" into MacsBugStr
  131.     DebugStr(MacsBugStr)
  132.   else
  133.     answer "Do INIT_3270_API to get memory handle."
  134.   end if
  135. end mouseUp
  136.  
  137. --------------------------------------------------------------------
  138. --
  139. -- background button DEBUG
  140. --
  141. -- Set the flag for XFCN internal use of DebugStr.
  142. --
  143. -- Script by John R. Powers, III
  144. --           Easy Street Software
  145. --
  146. -- XFCNs used: none
  147. -- XCMDs used: none
  148. -- HANDLERS used: none
  149. -- FUNCTIONS used: none
  150. --
  151. on mouseUp
  152.   global TD3270debug
  153.   answer "Set debug flag." with "On" or "Off"
  154.   if it is "On" then
  155.     answer "Debug when?" with "Before" or "After" or "Both"
  156.     if it is "Before" then put 1 into TD3270debug
  157.     else if it is "After" then put 2 into TD3270debug
  158.     else if it is "Both" then put 3 into TD3270debug
  159.     set the hilite of target to true
  160.   else
  161.     put 0 into TD3270debug
  162.     set the hilite of target to false
  163.   end if
  164. end mouseUp
  165.